home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Performance Co-Pilot 1.3
/
SGI Performance Co-Pilot 1.3.iso
/
dist
/
dist6.4
/
pcp.idb
/
usr
/
share
/
catman
/
u_man
/
cat3
/
PMAPI
/
pmdagetopt.z
/
pmdagetopt
Wrap
Text File
|
1997-04-03
|
8KB
|
133 lines
PPPPMMMMDDDDAAAAGGGGEEEETTTTOOOOPPPPTTTT((((3333)))) PPPPMMMMDDDDAAAAGGGGEEEETTTTOOOOPPPPTTTT((((3333))))
NNNNAAAAMMMMEEEE
ppppmmmmddddaaaaGGGGeeeettttOOOOpppptttt - get options from argument vector, trapping generic PMDA
options
CCCC SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
####iiiinnnncccclllluuuuddddeeee <<<<ppppccccpppp////ppppmmmmaaaappppiiii....hhhh>>>>
####iiiinnnncccclllluuuuddddeeee <<<<ppppccccpppp////iiiimmmmppppllll....hhhh>>>>
####iiiinnnncccclllluuuuddddeeee <<<<ppppccccpppp////ppppmmmmddddaaaa....hhhh>>>>
iiiinnnntttt ppppmmmmddddaaaaGGGGeeeettttOOOOpppptttt((((iiiinnnntttt aaaarrrrggggcccc,,,, cccchhhhaaaarrrr ****ccccoooonnnnsssstttt ****aaaarrrrggggvvvv,,,, ccccoooonnnnsssstttt cccchhhhaaaarrrr ****ooooppppttttssssttttrrrriiiinnnngggg,,,,
ppppmmmmddddaaaaIIIInnnntttteeeerrrrffffaaaacccceeee ****ddddiiiissssppppaaaattttcccchhhh,,,, iiiinnnntttt ****eeeerrrrrrrr))))
cccccccc ............ ----llllppppccccpppp____ppppmmmmddddaaaa ----llllppppccccpppp
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
This function is a wrapper for ggggeeeettttoooopppptttt(3). The behavior of the function
is identical except that certain options are assumed to have a predefined
behavior which initializes several fields in the ppppmmmmddddaaaaIIIInnnntttteeeerrrrffffaaaacccceeee structure.
The options that ppppmmmmddddaaaaGGGGeeeettttOOOOpppptttt will trap are:
----DDDD_t_r_a_c_e Set the PPPPMMMMAAAAPPPPIIII(3) debug control variable (ppppmmmmDDDDeeeebbbbuuuugggg) to
_t_r_a_c_e. Used for controlling levels of trace output while
debugging.
----dddd_d_o_m_a_i_n Set the _d_o_m_a_i_n number of this agent.
----hhhh_h_e_l_p_f_i_l_e Obtain the help text (see ppppmmmmddddaaaaTTTTeeeexxxxtttt(3)) for the metrics
from this file rather than from the path specified with
ppppmmmmddddaaaaDDDDSSSSOOOO(3) or ppppmmmmddddaaaaDDDDaaaaeeeemmmmoooonnnn(3).
----iiii_p_o_r_t Expect PMCD to connect on inet _p_o_r_t (number or name).
----llll_l_o_g_f_i_l_e Redirect diagnostics and trace output to _l_o_g_f_i_l_e.
----pppp Expect PMCD to supply stdin/stdout pipe.
----uuuu_s_o_c_k_e_t Expect PMCD to connect on unix domain _s_o_c_k_e_t.
Only one of ----dddd, ----pppp and ----uuuu may be specified. If none of these three
options is given, a pipe (----pppp) is assumed. When these options are
encountered by ppppmmmmddddaaaaGGGGeeeettttOOOOpppptttt, the option is processed and the next option is
examined. Therefore, ppppmmmmddddaaaaGGGGeeeettttOOOOpppptttt will only return when an option other
than those listed above is found, or the end of the list is reached. The
returned value will be the argument or EOF, respectively.
A PMDA can control which of these options the program will accept with
the _o_p_t_s_t_r_i_n_g argument. To accept all the options, the PMDA should call
ppppmmmmddddaaaaGGGGeeeettttOOOOpppptttt with the option string "D:d:h:i:l:pu:". Any PMDA specific
options should be added to this string in the style of ggggeeeettttoooopppptttt(3), and
returned by ppppmmmmddddaaaaGGGGeeeettttOOOOpppptttt if encountered. However, the PMDA cannot reuse
any of the options specified above.
PPPPaaaaggggeeee 1111
PPPPMMMMDDDDAAAAGGGGEEEETTTTOOOOPPPPTTTT((((3333)))) PPPPMMMMDDDDAAAAGGGGEEEETTTTOOOOPPPPTTTT((((3333))))
ppppmmmmddddaaaaGGGGeeeettttOOOOpppptttt takes a pointer to an int, _e_r_r, which is used as an error
count. This variable should be initialized to zero before ppppmmmmddddaaaaGGGGeeeettttOOOOpppptttt is
first called, and tested when ppppmmmmddddaaaaGGGGeeeettttOOOOpppptttt returns EOF.
ppppmmmmddddaaaaGGGGeeeettttOOOOpppptttt does not modify _a_r_g_c or _a_r_g_v.
EEEEXXXXAAAAMMMMPPPPLLLLEEEE
A PMDA which takes the additional argument ----nnnn and does not use ppppmmmmDDDDeeeebbbbuuuugggg
might call ppppmmmmddddaaaaGGGGeeeettttOOOOpppptttt like this:
pmdaInterface dispatch;
int err = 0;
int c = 0;
while ((c = pmdaGetOpt(argv, argc, "d:h:i:l:pu:n:",
dispatch &err)) != EOF) {
/* process argument 'n', may use optarg etc. */
}
if (err)
usage(argv[0]);
The global variables used by ggggeeeettttoooopppptttt ((((3333)))) may be used by the caller of
ppppmmmmddddaaaaGGGGeeeettttOOOOpppptttt within the argument parsing loop.
DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
ppppmmmmddddaaaaGGGGeeeettttOOOOpppptttt will display the same error messages as ggggeeeettttoooopppptttt.
CCCCAAAAVVVVEEEEAAAATTTT
The options ----DDDD, ----dddd, ----iiii, ----llll, ----pppp and ----uuuu cannot be reused for other purposes
by the PMDA.
The PMDA must be using PPPPMMMMDDDDAAAA____PPPPRRRROOOOTTTTOOOOCCCCOOOOLLLL____2222 or later, as specified in the call
to ppppmmmmddddaaaaDDDDSSSSOOOO(3) or ppppmmmmddddaaaaDDDDaaaaeeeemmmmoooonnnn(3).
SSSSEEEEEEEE AAAALLLLSSSSOOOO
ppppmmmmddddbbbbgggg(1), ggggeeeettttoooopppptttt(3), PPPPMMMMDDDDAAAA(3), ppppmmmmddddaaaaDDDDSSSSOOOO(3), ppppmmmmddddaaaaDDDDaaaaeeeemmmmoooonnnn(3) and ppppmmmmddddaaaaTTTTeeeexxxxtttt(3).
PPPPaaaaggggeeee 2222